package _11_位运算;

public class _190_颠倒二进制位 {

    public static void main(String[] args) {
        _190_颠倒二进制位 v = new _190_颠倒二进制位();
        System.out.println(Integer.toBinaryString(43261596));
        System.out.println(v.reverseBits(43261596));
    }

    // 颠倒
    public int reverseBits(int n) {
        int res = 0;
        int i = 0;
        while (n != 0) {
            res |= (n & 1) << (31 - i++);
            n >>>= 1;
        }
        return res;
    }

}
